package com.opensms.eventLogFacade.actions;

import java.sql.Connection;
import java.util.Collection;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.opensms.eventLogFacade.dao.SQLEventLogDAO;
import com.opensms.eventLogFacade.dao.StandardSQLEventLogDAO;
import com.util.exceptions.InternalErrorException;
import com.util.exceptions.ModelException;
import com.util.sql.TransactionalPlainAction;

public class FindByTypeEventLogAction implements TransactionalPlainAction {
	private static Log log = LogFactory.getLog(FindByTypeEventLogAction.class);
	
	private char type;

	public FindByTypeEventLogAction(char type) {
		this.type = type;
	}

	public Object execute(Connection connection) throws ModelException, InternalErrorException {
		try{
			SQLEventLogDAO dao = new StandardSQLEventLogDAO();
			Collection coll = dao.findByType(connection, this.type);
			return coll;
								
		}catch (Exception e){
			throw new InternalErrorException(e);
		}
	}
}
